package com.example.attempt.config;


import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

/**
 * 文件路径配置，可以直接访问
 * 映射的路径后面必须加/，否则访问不到
 */
@Configuration
public class FilePathConfig implements WebMvcConfigurer {
    private String mypath="D:\\IDEA\\mutual-evaluation\\src\\main\\resources\\";

    @Override
    public void addResourceHandlers(ResourceHandlerRegistry registry) {
        registry.addResourceHandler("/homework/**")
                .addResourceLocations("file:"+mypath+"homework/");
        registry.addResourceHandler("/submit/**")
        .addResourceLocations("file:"+mypath+"submit/");
        registry.addResourceHandler("/grade/**")
                .addResourceLocations("file:"+mypath+"grade/");
    }

}